﻿using System;
using System.Collections.Generic;
using System.Text;
using log4net.Appender;
using log4net.Core;

namespace RollBack.src.ui
{
    class RollbackAppender : AppenderSkeleton
    {
        public LogMessageViewer m_LogMessageViewer
        {
            get;
            set;
        }

        public volatile bool m_disabled;

        public RollbackAppender()
        {
            m_disabled = false;
        }

        protected override void Append(log4net.Core.LoggingEvent loggingEvent)
        {
            if (m_LogMessageViewer != null && !m_disabled)
            {
                string msg = RenderLoggingEvent(loggingEvent);
                m_LogMessageViewer.addLogLine(loggingEvent,msg);
            }
        }
    }
}
